﻿Public Class Cambiocontraseña_c
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        seguridad.verificapermisos()
    End Sub

    Protected Sub ASPxButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ASPxButton1.Click



        Try
            Dim user As String
            user = seguridad.usuarioid1
            Dim tabladapter As New DataSet1TableAdapters.usuariosTableAdapter
            tabladapter.UpdateQueryActualizaContraseña(txtpassnueva.Text, user)
        Catch ex As Exception

        End Try
        txtpassnueva.Text = ""
        txtpassrepetida.Text = ""
        System.Web.HttpContext.Current.Response.Redirect("~/inicio1.aspx")
        '  MsgBox(tabladapter.GetDataBy2Retornacontraseña(user).Item(0).usuariopass.ToString())


        'Dim lNewVariable As String = String.Format("SELECT        usuarioid , usuariopass   FROM usuarios WHERE usuarioid = '{0}'", user)
        'Dim conn As New Devart.Data.PostgreSql.PgSqlConnection(seguridad.conexion)
        'Dim ejec As New Devart.Data.PostgreSql.PgSqlCommand(lNewVariable, conn)
        'conn.Open()
        'Dim registro As Devart.Data.PostgreSql.PgSqlDataReader = ejec.ExecuteReader
        ''Dim passactual As String
        ''passactual = 
        'MsgBox(Convert.ToString(registro.GetPgSqlText(0)))

        ''If txtpassacutal.Text <> passactual Then

        '    MsgBox("Ingrese su contraseña actual")
        'Else
        '    conn.Close()
        '    Dim queryactualiza As String = String.Format("UPDATE       usuarios  SET                 usuariopass ='{0}' WHERE        (usuarioid = {1})", txtpassnueva.Text, user)
        '    Dim ejec2 As New Devart.Data.PostgreSql.PgSqlCommand(queryactualiza, conn)
        '    conn.Open()
        '    ejec2.ExecuteNonQuery()
        '    MsgBox("actualizó")
        'End If


    End Sub


End Class